#include <iostream>
#include "UdpServer.hpp"
#include <memory>
std::string defaulthandler(const std::string &message)
{
    std::string hello = "hello, ";
    hello += message;
    return hello;
}
using namespace std;
int main(int argc,char *argv[])
{
    if(argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " port" << std::endl;
        return 1;
    }
    uint16_t port = std::stoi(argv[1]);//将命令行传入的字符串转换为端口号
    std::unique_ptr<UdpServer> usvr = std::make_unique<UdpServer>(port, defaulthandler);//使用std::unique_ptr智能指针创建UdpServer对象
    usvr->Init();
    usvr->Start();
    return 0;
}